package com.claire.jing.Common;

public class Result<T>{
    private int status;
    private T data;
    private String message;

    public Result() {
    }

    public Result(int status, T data, String message) {
        this.status = status;
        this.data = data;
        this.message = message;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public  static <E> Result success(E data){
        Result result = new Result();
        result.setStatus(1);
        result.setMessage(null);
        result.setData(data);

        return result;
    }

    public static <E>Result fail(E e,int status,String message){
        Result result = new Result();
        result.setStatus(status);
        result.setMessage(message);
        result.setData(null);

        return result;
    }
}
